/**
 * 判断是否是空对象
 * @param obj 一定是对象
 */

var HttpRes = require('../constant/response')


function MyUtils() {

    this.isEmptyObj = function (obj) {
        if ((typeof obj) === 'object') {
            for (var name in obj) {
                return false;
            }
            return true
        } else {
            return false
        }
    }
    this.generateSuccess = function () {
        return new HttpRes().successRes
    }
    this.generateError = function () {
        return new HttpRes().errorRes
    }
    this.generateInnerError = function () {
        var httpRes = new HttpRes().errorRes
        httpRes.model = {
            success: -1,
            info: '服务器异常'
        }
    }
}

module.exports = MyUtils
